const express = require("express");
const merchandiseRouter = express.Router();
const merchandiseServer = require("../../server/merchandiseServer");
const sendMsg = require("../reqSendResult");
// 添加商品
merchandiseRouter.post(
  "/addMerchandise",
  sendMsg.asyncHandler(async (req, res, next) => {
    // 验证参数
    // await addMerchandiseValidate(req, res, next);
    return await merchandiseServer.addMerchandise(req.body);
  }, "添加商品成功")
);
// // 获取商品列表
merchandiseRouter.get(
  "/getList",
  sendMsg.asyncHandler(async (req, res) => {
    // 验证参数
    // await getShopValidate(req);
    return await merchandiseServer.getMerchandise(req.query.page, req.query.limit, req.query.keyword);
  }, "获取商品列表成功")
);

module.exports = merchandiseRouter;